package com.example.demo0

import com.example.util.p


class Printer{
    fun drawLine(){
        p("--------------------------")
    }
    
    fun drawDottedLine(){
        p("- - - - -")
    }
    
    
    fun drawStars(){
        
        p("**********")
        
    }
    
}

fun Printer.startDraw(decorated:Printer.()->Unit){
    p("+++ start drawing +++")
    this.decorated()
    p("+++ end drawing +++")
}

fun main(){
    Printer().run {
        startDraw {
            drawLine()
        }
        startDraw {
            drawDottedLine()
        }
        startDraw {
            drawStars()
        }

    }
}










